// import './css/postcss.css'
import './css/index.css'
import aa from './img/02.jpg'
import './2.js'
import './main'
console.log('webpack!!!')

function createDiv(params) {
  const app = document.getElementById('app')

  const div = document.createElement('div')
  div.className = 'divContainer'
  div.innerText = 'div'

  const p  = document.createElement('p')
  p.className = 'title'
  p.innerHTML = 'p 标签 --- 标题'



  app.appendChild(div)
  div.appendChild(p)
}
function packImg(params) {
  const app = document.getElementById('app')

  // 创建一个容器元素
  const oElI = document.createElement('div')
  // 创建 img 标签，添加 src 属性
  const oImg = document.createElement('img')
  oImg.width = 400;
  // dd
  oImg.src = aa;
  app.appendChild(oElI);
  oElI.appendChild(oImg);
}

function video(params) {
//   <video src="../src/img/02.mp4" autoplay="false" loop="false" muted="false"
//   >
//  </video>
  const app = document.getElementById('app')

  const video = document.createElement('video')
  video.src = require('./img/02.mp4')
  video.setAttribute('autoplay', false)
  video.setAttribute('loop', false)
  video.setAttribute('muted', false)

  app.appendChild(video)
}

function addButton() {
  const app = document.getElementById('app')

  const btn = document.createElement('button')
  btn.innerHTML = '点击'
  const handleClick = (event) => {
    console.log('点击事件')
  }
  btn.addEventListener('click', handleClick)
  app.appendChild(btn)
}

createDiv()
packImg()
video()
addButton()


// const add = () => {
//   console.log(123456)
// }
// add()

class Add {
  constructor(props) {
    this.count = 1
  }
  addCount() {
    console.log(this.count + 7)
  }
}

const addObj = new Add()
addObj.addCount()


// function * gen() {
//   yield 1;
//   yield 2;
// }

// gen()

const promiseObj = new Promise((resolve, reject) => {
  resolve(1111)
})

promiseObj.then(res => {
  console.log(res)
})

console.log(Object.assign({}, { a: 1 }, { b: 2 }))